import request from '../utils/request';//导入帮助类里面的request对象，帮助我们发送请求给后端api接口

export const getUserList = query => {
    return request({
        url: '/api/Users',
        method: 'get',//get请求用params
        params: query
    });
};
//角色列表（用户分页组合查询）
export const rolelist = query => {
    return request({
        url: '/api/Roles',
        method: 'get',//get请求用params
        params: query
    });
};
//刷新Token
export const fetchData = query => {
    return request({
        url: '/api/Jwt/JwtToken',
        method: 'get',//get请求用data
        params: query
    });
};
//添加角色
export const rolesadd = query => {
    return request({
        url: '/api/Roles',
        method: 'post',
        data: query,
    });
};
//角色删除
export const roledelete = id => {
    return request({
        url: '/api/Roles?id='+id,//路由传参
        method: 'delete',
    });
};
//角色添加权限
export const addTreeAuthority=query=>{
    return request({
        url: '/api/Roles/addPermission',
        method: 'post',
        data: query
    });
};
//权限
export const getTreeAuthority=query=>{
    return request({
        url: 'api/Permission/',
        method: 'get',
        params: query
    });
};
//根据角色查权限
export const getPer=query=>{
    return request({
        url: '/api/Roles/'+query,
        method: 'get',
    });
}
